/**
 * @file 10.c
 * @author your name (you@domain.com)
 * @brief 一个数的阶乘
 * @version 0.1
 * @date 2022-04-13
 * 
 * @copyright Copyright (c) 2022
 * 
 */
#include <stdio.h>

int main()
{
    int n, i;
    unsigned long long factorial = 1;
    printf("Enter an integer:");
    scanf("%d", &n);
    // show error if the user enters a negative integer
    if (n < 0)
    {
        printf("Error! Factorial of a negative number doesn't exist.");
    }
    else
    {
        for (i = 1; i <= n; ++i)
        {
            factorial *= i;
        }
        printf("Factorial of %d = %llu\n", n, factorial);
    }
    return 0;
}